<template src="./index.html"></template>

<script>
import MedicalRecordOperationHistoryService from "../../../../../_services/medicalRecordOperationHistory.service";
export default {
  name: "TianDingPatientMePastHistoryComponent",
  props: ["user"],
  data() {
    return {
      operationHistoryList: []
    };
  },
  mounted() {
    this.getOperationHistoryByUserID();
  },
  methods: {
    getOperationHistoryByUserID() {
      this.indicator$.open("正在加载...");
      this.operationHistoryList = [];
      let user = JSON.parse(this.local$.getItem("tdUser"));
      let params = {};
      params.userid = user.UserID;
      MedicalRecordOperationHistoryService.getOperationHistoryByUserID(
        params
      ).then(response => {
        if (response && response.Data.length > 0) {
          this.operationHistoryList = response.Data;
        }
        this.indicator$.close();
      });
    },
    btnModify(item) {
      this.local$.removeItem("tdPastHistory");
      if (item !== undefined) {
        this.local$.setItem("tdPastHistory", JSON.stringify(item));
        this.$router.push({
          name: "tdPatientMeMedicalPastHistoryModify",
          params: item
        });
      } else {
        this.$router.push({
          name: "tdPatientMeMedicalPastHistoryModify"
        });
      }
    },
    btnPrev() {
      let menu = JSON.parse(this.local$.getItem("tdMeLeftMenus"));
      menu.prev = "prev";
      this.$emit("change", menu);
    },
    btnNext() {
      let menu = JSON.parse(this.local$.getItem("tdMeLeftMenus"));
      menu.next = "next";
      this.$emit("change", menu);
    }
  }
};
</script>

<style lang="scss">
.medical-record-past-history {
  .btn-box {
    margin-bottom: 20px;
  }
}
</style>

